<script language='JavaScript' type='text/javascript'>
function encryptpwd()
{
key = document.forms[0].secretkey.value;

	
}
</script>
<div id="maincontent">
<%= render :partial => "shared_common_files/data_area_help_bar" %>

<h2>Mashup Create/Update</h2>					

<% if (params['node'] == "salesforce") %>

<%
    # following wsdl_url is used only if the db does not have the value.
	# this is a fall back option
	@wsdl_url = "/app/apis/integration/salesforce/salesforce-enterprise.wsdl"
	@password = ""
	if @mashup_node!=nil 
		if @mashup_node.wsdl_url!=nil
			@wsdl_url = @mashup_node.wsdl_url
		end
		if @mashup_node.password!=nil
			@password = AjubyTools.base64decode(@mashup_node.password)
		end
	end
%>
<%= start_form_tag({:action => 'save'},{:class => 'appform'}, {:method=> 'post'}) %>

	<div class="req"><b>*</b>Required Information </div>

	<fieldset>
		<h3> Enter web service details for Salesforce</h3>
		
		<%=error_messages_for("mashup_node")%>
		
		<!-- label for="name"><b><span class="req">*</span>Mashup Name :</b -->
			<input class="f-name" type="hidden" name="mashup_node[name]" required="true" size="30" value="<%=params['node']%>"/>
		<!-- /label -->
		
		<label for="name"><b><span class="req">*</span>User Name :</b>
			<input class="f-name" type="text" name="mashup_node[username]" required="true" size="30" value="<%=@mashup_node.username%>"/><br />
		</label>
		
		<label for="name"><b><span class="req">*</span>Password :</b>
			<input class="f-comments" type="password" name="mashup_node[password]" size="30" value="<%=@password%>"/><br/>
		</label>
		
		<label for="name"><b><span class="req">*</span>WSDL URL :</b>
			<input class="f-name" type="text" name="mashup_node[wsdl_url]" required="true" size="30"  value="<%=@wsdl_url%>"/><br />
		</label>

		<label for="name"><b>Debug Flag :</b>
			<input class="f-name" type="text" name="mashup_node[debug_soap]" required="true" size="30"  value="<%=@mashup_node.debug_soap%>"/><br />
		</label>

		<label for="name"><b>Default Records Size :</b>
			<input class="f-name" type="text" name="mashup_node[records_size]" required="true" size="30"  value="<%=@mashup_node.records_size%>"/><br />
		</label>


<%elsif (params['node'] == "sugarcrm") %>

<%
    # following wsdl_url is used only if the db does not have the value.
	# this is a fall back option
	@wsdl_url = ""
	@password = ""
	if @mashup_node!=nil 
		if @mashup_node.wsdl_url!=nil
			@wsdl_url = @mashup_node.wsdl_url
		end
		if @mashup_node.password!=nil
			@password = AjubyTools.base64decode(@mashup_node.password)
		end
	end
%>
<%= start_form_tag({:action => 'save'},{:class => 'appform'}, {:method=> 'post'}) %>

	<div class="req"><b>*</b>Required Information </div>

	<fieldset>
		<h3> Enter web service details for SugarCRM </h3>
		
		<%=error_messages_for("mashup_node")%>
		
		<!-- label for="name"><b><span class="req">*</span>Mashup Name :</b -->
			<input class="f-name" type="hidden" name="mashup_node[name]" required="true" size="30" value="<%=params['node']%>"/>
		<!-- /label -->
		
		<label for="name"><b><span class="req">*</span>User Name :</b>
			<input class="f-name" type="text" name="mashup_node[username]" required="true" size="30" value="<%=@mashup_node.username%>"/><br />
		</label>
		
		<label for="name"><b><span class="req">*</span>Password :</b>
			<input class="f-comments" type="password" name="mashup_node[password]" size="30" value="<%=@password%>"/><br/>
		</label>
		
		<label for="name"><b><span class="req">*</span>WSDL URL :</b>
			<input class="f-name" type="text" name="mashup_node[wsdl_url]" required="true" size="30"  value="<%=@wsdl_url%>"/><br />
		</label>

		<label for="name"><b>Debug Flag :</b>
			<input class="f-name" type="text" name="mashup_node[debug_soap]" required="true" size="30"  value="<%=@mashup_node.debug_soap%>"/><br />
		</label>

		<label for="name"><b>Default Records Size :</b>
			<input class="f-name" type="text" name="mashup_node[records_size]" required="true" size="30"  value="<%=@mashup_node.records_size%>"/><br />
		</label>
		
<%elsif(params['node'] == "amazonws")%>
<%
		if @mashup_node!=nil 
		
			if @mashup_node.custom_field2!=nil
				@secret_key = AjubyTools.base64decode(@mashup_node.custom_field2)
			end
		end
%>
<%= start_form_tag({:action => 'save'},{:class => 'appform'}, {:method=> 'post'}) %>

	<div class="req"><b>*</b>Required Information </div>

	<fieldset>
		<h3> Enter web service details for Amazon</h3>		

		<input class="f-name" type="hidden" name="mashup_node[name]" required="true" size="30" value="<%=params['node']%>"/>
	
		<%if(@mashup_node.user_id==current_user.id)%>	
			<label for="name"><b><span class="req">*</span>Access Key Id :</b>
				<input class="f-name" type="text" name="mashup_node[access_key]" required="true" size="30" value="<%=@mashup_node.custom_field1%>"/><br />
			</label>
		
			<label for="name"><b><span class="req">*</span>Secret Access Key :</b>
				<input class="f-comments" type="password" name="mashup_node[secret_key]" size="30" value="<%=@secret_key%>"/><br/>
			</label>
			
			
		<%else%>
			<label for="name"><b><span class="req">*</span>Access Key Id :</b>
				<input class="f-name" type="text" name="mashup_node[access_key]" required="true" size="30" value=""/><br />
			</label>
		
			<label for="name"><b><span class="req">*</span>Secret Access Key :</b>
				<input class="f-comments" type="password" name="mashup_node[secret_key]" size="30" value=""/><br/>
			</label>
			
			
		<%end%>
		
<%elsif (params['node'] == "basecamp") %>
	
<%
    # following wsdl_url is used only if the db does not have the value.
	# this is a fall back option
	@wsdl_url = ""
	@password = ""
	if @mashup_node!=nil 
		if @mashup_node.wsdl_url!=nil
			@wsdl_url = @mashup_node.wsdl_url
		end
		if @mashup_node.password!=nil
			@password = AjubyTools.base64decode(@mashup_node.password)
		end
	end
%>

<%= start_form_tag({:action => 'save'},{:class => 'appform'}, {:method=> 'post'}) %>

	<div class="req"><b>*</b>Required Information </div>

	<fieldset>
		<h3> Enter web service details for Basecamp </h3>
		
		<%=error_messages_for("mashup_node")%>
		
		<input class="f-name" type="hidden" name="mashup_node[name]" required="true" size="30" value="<%=params['node']%>"/>
	
		<%if(@mashup_node.user_id==current_user.id)%>	
		
			<label for="name"><b><span class="req">*</span>User Name :</b>
				<input class="f-name" type="text" name="mashup_node[username]" required="true" size="30" value="<%=@mashup_node.username%>"/><br />
			</label>
			
			<label for="name"><b><span class="req">*</span>Password :</b>
				<input class="f-comments" type="password" name="mashup_node[password]" size="30" value="<%=@password%>"/><br/>
			</label>
			
			<label for="name"><b><span class="req">*</span>URL :</b>
				<input class="f-name" type="text" name="mashup_node[wsdl_url]" required="true" size="30"  value="<%=@wsdl_url%>"/><b>(your.basecamp.com)</b><br />
			</label>
				
			
		<%else%>
			<label for="name"><b><span class="req">*</span>User Name :</b>
				<input class="f-name" type="text" name="mashup_node[username]" required="true" size="30" /><br />
			</label>
			
			<label for="name"><b><span class="req">*</span>Password :</b>
				<input class="f-comments" type="password" name="mashup_node[password]" size="30" /><br/>
			</label>
			
			<label for="name"><b><span class="req">*</span>URL :</b>
				<input class="f-name" type="text" name="mashup_node[wsdl_url]" required="true" size="30" /><b>(your.basecamp.com)</b><br />
			</label>
			
		<%end%>
		
<%end%>

     <input type="hidden" name="node" value="<%=params['node']%>">
     <!-- input type="hidden" name="op" value="save" -->
     <div class="f-submit-wrap">
		<!-- input type="submit" name="crnewform" value="Save" / -->
		<!-- input type="button" value="Cancel" onclick="javascript:history.go(-1);"/ -->
		<%= image_submit_tag "/themes/odotclassic/images/btn_save.png",:alt => 'Save', :border => 0 %>
		<%= link_if_authorized image_tag('/themes/odotclassic/images/btn_cancel.gif', :alt=>'Cancel'), {:controller => '/controlpanel' , :action => 'list'}  %>
	  </div>
	  		
		</fieldset>
<%= end_form_tag %>
 	
</div>
